home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS05.ADF / menudemo / demo.c < prev    next >
C/C++ Source or Header  |  1986-01-15  |  4KB  |  112 lines

  1.  
  2. /*********************************************************************/
  3. /* demo.c AmigaLink 1/25/86                                          */
  4. /*                     Copyright (c) 1985                            */
  5. /*                    Commodore-Amiga, Inc.                          */
  6. /*                    All rights reserved.                           */
  7. /*                                                                   */
  8. /*     No part of this program may be reproduced, transmitted,       */
  9. /*     transcribed, stored in retrieval system, or translated        */
  10. /*     into any language or computer language, in any form or        */
  11. /*     by any means, electronic, mechanical, magnetic, optical,      */
  12. /*     chemical, manual or otherwise, without the prior written      */
  13. /*     permission of:                                                */
  14. /*                     Commodore-Amiga, Inc.                         */
  15. /*                     983 University Ave #D                         */
  16. /*                     Los Gatos, CA. 95030                          */
  17. /*                                                                   */
  18. /*********************************************************************/
  19.  
  20. /*********************************************************************/
  21. /*                                                                   */
  22. /*  Program name:  demo                                              */
  23. /*  Programmer:    Andy Finkel                                          */ 
  24. /*                                                                   */
  25. /*  Purpose:  To demo some Intuition functions, like menus.          */
  26. /*                                                                   */
  27. /*********************************************************************/
  28.  
  29. #include "standard.h"
  30. #include "workbench/startup.h"
  31.  
  32.  
  33. #define MENUPROJECT 0
  34. #define MENUEDIT 1
  35. #define MENUSTYLES 2
  36. #define MENUCOLORS 3
  37.  
  38. #define BLUE 0
  39. #define WHITE 1
  40. #define BLACK 2
  41. #define RED 3
  42.  
  43. ULONG GfxBase;
  44. ULONG IntuitionBase;
  45. ULONG DosBase;
  46. ULONG DiskfontBase;
  47. ULONG IconBase;
  48.  
  49. extern struct MsgPort consoleMsgPort;
  50.  
  51. extern struct Window *OpenWindow();
  52. extern struct Window *window;
  53. extern struct IntuiMessage *message;
  54.  
  55. ULONG WakeUpBit;
  56.  
  57. main(wbmessage,argv)
  58. struct WBStartup *wbmessage;
  59. char *argv[];
  60. {
  61.      int   inChar;       /* character coming from the console */
  62.      UBYTE str[80];
  63.  
  64.      startup(wbmessage,argv); /* startup menu, fonts, etc */
  65.  
  66.      while (TRUE)        /* all the time in fact ! */
  67.      {
  68.           WakeUpBit= Wait((1<<window->UserPort->mp_SigBit)|
  69.                (1<<consoleMsgPort.mp_SigBit));
  70.  
  71.           /* first check if it was an intuition message */
  72.           if(WakeUpBit & (1<<window->UserPort->mp_SigBit))
  73.           {
  74.                while(message=(struct IntuiMessage *)
  75.                     GetMsg(window->UserPort))
  76.                {
  77.                switch(message->Class)
  78.                     {
  79.                     case CLOSEWINDOW:
  80.                        closewindow(message,window);
  81.                        break;
  82.  
  83.                     case REFRESHWINDOW:
  84.                                  BeginRefresh(window);
  85.                        CDPutStr("Refresh Message\r\n");
  86.                        EndRefresh(window,TRUE);
  87.                        ReplyMsg(message);
  88.                        break;
  89.  
  90.                     case MENUPICK:
  91.                        if((message->Code)!=MENUNULL)
  92.                        MenuPick(message,window);
  93.                        ReplyMsg(message);
  94.                        break;
  95.  
  96.                     default:
  97.                        ReplyMsg(message);
  98.                     }
  99.                }
  100.           }
  101.  
  102.           /* now check if there was a console (got key) message */
  103.  
  104.           if(WakeUpBit & (1<<consoleMsgPort.mp_SigBit)) {
  105.               while((inChar=CDMayGetChar()) != (-1) ){/* char waiting */
  106.                CDPutChar(inChar);
  107.               }
  108.           }
  109.      }
  110. }
  111.  
  112.